<template>
  <el-dialog
    :title="title"
    :visible.sync="open"
    width="800px"
    append-to-body
    :close-on-click-modal="false"
    @close="closeModal"
  >
    <div>
      <div class="fz-15 fw-7 color3 pb-10">用户信息</div>
      <el-descriptions :column="2" :labelStyle="{width: '120px'}">
        <el-descriptions-item label="姓名">{{
          form.patientName
        }}</el-descriptions-item>
        <el-descriptions-item label="性别"
          ><dict-tag :options="dict.type.sys_user_sex" :value="form.patientSex"
        /></el-descriptions-item>
        <el-descriptions-item label="年龄">{{
          form.patientAge
        }}</el-descriptions-item>
        <el-descriptions-item label="电话">{{
          form.patientPhone
        }}</el-descriptions-item>
      </el-descriptions>
    </div>
    <div>
      <div class="fz-15 fw-7 color3 py-10">采集调用及结果</div>
      <el-descriptions :column="2" :labelStyle="{width: '120px'}">
        <el-descriptions-item label="照片类型">{{
          form.imageType === 1 ? "舌相" : "面相"
        }}</el-descriptions-item>
        <el-descriptions-item label="照片"
          ><image-preview
            v-if="form.imageUrl"
            :src="form.imageUrl"
            :width="50"
            :height="50"
          />
        </el-descriptions-item>
        <el-descriptions-item label="调用时间">{{
          parseTime(form.requestTime)
        }}</el-descriptions-item>
        <el-descriptions-item label="辨识结果">
          <div v-if="form.resultCode === 1">成功</div>
          <div v-if="form.resultCode === 2">
            失败
            <div v-if="form.resultMessage" class="colorRED pl-5 fz-12">
              ({{ form.resultMessage }})
            </div>
          </div>
        </el-descriptions-item>
      </el-descriptions>
    </div>
    <div>
      <template v-if="form.imageType === 1">
        <template v-if="form.chars">
          <div class="fz-15 fw-7 color3 py-10">结果描述及概率</div>
          <el-descriptions :column="1" border>
            <el-descriptions-item v-for="(item,index) in form.chars" :labelStyle="{width: '120px'}" :key="index" :label="charTitles[index]">{{item.type + '(' + item.probability + ')'}}</el-descriptions-item>
          </el-descriptions>
        </template>
        <template v-if="form.syndrome">
          <div class="fz-15 fw-7 color3 pt-10">调理建议</div>
          <el-descriptions v-for="(item,index) in form.syndrome" :key="index" class="mt-10" :column="1" border :labelStyle="{width: '120px'}">
            <el-descriptions-item label="中药方剂">{{item.zhongyaofangji}}</el-descriptions-item>
            <el-descriptions-item label="方剂组成">{{item.fangjizucheng}}</el-descriptions-item>
            <el-descriptions-item label="食疗">{{item.shiliao}}</el-descriptions-item>
            <el-descriptions-item label="治则治法">{{item.zhizezhifa}}</el-descriptions-item>
            <el-descriptions-item label="气功疗法">{{item.qigong}}</el-descriptions-item>
            <el-descriptions-item label="证型">{{item.syndrome}}</el-descriptions-item>
            <el-descriptions-item label="拔罐疗法">{{item.baguan}}</el-descriptions-item>
            <el-descriptions-item label="中成药">{{item.zhongchengyao}}</el-descriptions-item>
            <el-descriptions-item label="疾病概要">{{item.bingjigaiyao}}</el-descriptions-item>
            <el-descriptions-item label="针灸配穴">{{item.zhenjiupeixue}}</el-descriptions-item>
            <el-descriptions-item label="针灸主穴">{{item.zhenjiuzhuxue}}</el-descriptions-item>
          </el-descriptions>
        </template>
      </template>

      <template v-if="form.imageType !== 1 && form.face">
        <div class="fz-15 fw-7 color3 py-10">结果描述及概率</div>
        <el-descriptions :column="1" border :labelStyle="{width: '120px'}">
          <el-descriptions-item label="鼻子情况">{{form.face.nose}}</el-descriptions-item>
          <el-descriptions-item label="头发情况">{{form.face.hair}}</el-descriptions-item>
          <el-descriptions-item label="脸部情况">{{form.face.FaceColor}}</el-descriptions-item>
          <el-descriptions-item label="左脸斑点">{{form.face.LeftBanDian}}</el-descriptions-item>
          <el-descriptions-item label="左脸痤疮">{{form.face.LeftCc}}</el-descriptions-item>
          <el-descriptions-item label="右脸斑点">{{form.face.RightBanDian}}</el-descriptions-item>
          <el-descriptions-item label="右脸痤疮">{{form.face.RightCc}}</el-descriptions-item>
          <el-descriptions-item label="嘴唇颜色">{{form.face.LipColor}}</el-descriptions-item>
          <el-descriptions-item label="嘴唇湿润情况">{{form.face.lipWater}}</el-descriptions-item>
        </el-descriptions>
      </template>

    </div>
    <div slot="footer" class="dialog-footer">
      <el-button type="primary" @click="open = false">确 定</el-button>
    </div>
  </el-dialog>
</template>

<script>
import echarts from 'echarts'

export default {
  dicts: ["sys_user_sex"],
  data() {
    return {
      title: "详情",
      open: false,
      form: {},
      charTitles: ["苔色","苔薄厚","是否有齿痕","是否有点刺","是否有裂纹","苔腻腐","舌形","燥苔","舌质色","是否为剥苔"],
    }
  },
  methods: {
    openModal(row) {
      this.form = row;
      this.open = true;
    },
    closeModal() {
      this.$refs["form"].resetFields();
      Object.assign(this.$data, this.$options.data()); // 存在自定义校验规则不能重置data
    }
  }
}
</script>

<style lang="scss" scoped>
</style>
